;
; This is template executable for Ganymede-x86 translator, 
; which is patched by the program and become truly independent,
; translated from Ganymede processor tasm, executable file
;
; Copyright (c) Ivanychev Sergey, DCAM MIPT, 2014
; sergeyivanychev@gmail.com

.586

.model flat, stdcall
option casemap:none

include 	windows.inc
include 	kernel32.inc
include 	masm32.inc
include 	msvcrt.inc
include 	shell32.inc
includelib 	masm32.lib
includelib 	kernel32.lib
includelib 	msvcrt.lib

printf		PROTO C	 : VARARG
getchar		PROTO C
scanf		PROTO C	 : VARARG
memcpy		PROTO C	 dest: dword, src : dword, size_t : dword
pow			PROTO C  base: real8, exponent: real8
putchar		PROTO C  character: byte

.data

__AX			REAL8 0.0
__BX			REAL8 0.0
__CX			REAL8 0.0
__DX			REAL8 0.0

__DI			REAL8 0.0
__SI			REAL8 0.0

__BUFFER		byte 0
__FIO			byte "%lg",0

__ENTER			byte 13, 10, 0
__SPACE			byte 32, 0
__TAB			byte 9 , 0

__ABOVE			word 0000h
__BELOW			word 0010h
__EQUAL			word 4000h
__UNEQU			word 4410h
__FERROR		word 1011111111101111b
__FLOAT_ERROR	byte "Floating point calculation error. CR:[%04x] Terminating", 0

__PRINTFADDR	byte 	"PRINTF-0x0040371E"
__GETCHARADDR	byte 	"GETCHAR-0x00403724"
__SCANFADDR		byte 	"SCANF-0x0040372A"
__MEMCPYADDR	byte 	"MEMCPY-0x00403730"
__POWADDR		byte 	"POW-0x00403736"
__PUTCHARADDR	byte 	"PUTCHAR-0x0040373c"
__EXITPROCESSADDR byte 	"EXITPROCESS-0x00403718"


__SUCCESS		byte "Success!", 0
__FAILED		byte "Failed",   0

__SKIPUNTILID 	byte ">>>" 
__ID			byte "This executable was generated by Ganymede-x86 translator. Copyright (c) Ivanychev Sergey, sergeyivanychev@gmail.com, 2014. Thanks Ilya Dedinsky for huge support"
__SKIPAFTERID 	byte "<<<" 
__VERSION		byte "04.16.2014 12:40"

__VARS			REAL8 100 dup(0.0)				
.code




Start:					
				jmp __BEGINPARTY; will be changed if there are additional variables
__COPROC_ERROR:
				invoke printf, addr __FLOAT_ERROR, bx
				invoke getchar
				invoke ExitProcess, 0
__INITIALIZING:
				invoke scanf  ,	addr __FIO, 		addr __DI
				invoke pow    ,	real8 ptr __DI, 	real8 ptr __DI
				invoke putchar, byte ptr __BUFFER
				invoke memcpy ,	addr __DI, 			addr __DI, byte ptr __BUFFER
				invoke ExitProcess, 0 
				
				; variables are located here...
; -------------------------------------------------------------------------
				
				
				
				nop
				
				org 10000d
__BEGINPARTY:		
				invoke ExitProcess, 0
end Start


